#include <iostream>

using namespace std;

int findMax(int pigs[], int len) {
    int max = pigs[0];
    for(int i = 0; i < len; i++) {
        if (max <= pigs[i]) {
            max = pigs[i];
        }
    }
    return max;
}

int main() {

    int pigs[5] = { 300, 350, 200, 400, 250 };

    int max = findMax(pigs, sizeof(pigs) / sizeof(pigs[0]));

    // int max = pigs[0];

    // for(int i = 0; i < sizeof(pigs) / sizeof(pigs[0]); i++) {
    //     if (max <= pigs[i]) {
    //         max = pigs[i];
    //     }
    // }

    cout << "最重的小猪重:" << max << "kg" << endl;

    return 0;
}